<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html,body{
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 0;
        }
        .header{
            width: 100%;
            height: 120px;
            background-color: antiquewhite;
        }
        .nav{
            width: 100%;
            height: 80px;
            background-color: red;
            /* 脱离标准文档流,后面元素会往上面顶 */
            /* position: fixed;
            top: 200px; */
            /* 吸顶效果 */
            position: sticky;
            top: 0px;
        }
        .main{
            width: 100%;
            height: 1000px;
            background-color: cadetblue;
        }
    </style>
</head>
<body>
    <div class="header">头部</div>
    <div class="nav">导航</div>
    <div class="main">主体</div>
</body>
</html>